C++ AMP: Accelerated Massive Parallelism with Microsoft® Visual C++® by Kate Gregory & Ade Miller
Author:Kate Gregory & Ade Miller [Kate Gregory and Ade Miller]
Language: eng
Format: epub
Tags: COMPUTERS / Programming / Parallel
ISBN: 9780735664715
Publisher: Microsoft Press
Published: 2012-09-20T00:00:00+00:00
The total element count must be a multiple of the product of the tile size and the tile count.
This code sets up the appropriate constants and checks them:
const size_t elementCount = 16 * 1024 * 1024; const int tileSize = 512; const int tileCount = 128; // Used in cascading reductions // Make sure that elements can be split into tiles so the number of // tiles in any dimension is less than 65536. static_assert((elementCount / tileSize < 65536), "Workload is too large or tiles are too small. This will cause runtime errors."); static_assert((elementCount % (tileSize * tileCount) == 0), "Tile size and count are not matched to element count."); static_assert((elementCount != 0), "Number of elements cannot be zero."); static_assert((elementCount <= UINT_MAX), "Number of elements is too large."); std::wcout << "Running kernels with " << elementCount << " elements, " << elementCount * sizeof(int) / 1024 << " KB of data ..." << std::endl; std::wcout << "Tile size: " << tileSize << std::endl; std::wcout << "Tile count: " << tileCount << std::endl; if (!validateSizes(tileSize, elementCount)) std::wcout << "Tile size is not factor of element count." << std::endl;
Why check values that are hard-coded? A common use for this sample code is to experiment and tweak various settings. You might try increasing or decreasing the workload, for example, or making the tiles larger or smaller, but not all combinations of values will meet the constraints mentioned above. A compile time check and warning will remove some of the mystery from the process. When a static_assert fails, the build fails and you canât run the application. If you want to trigger the run-time errors in order to see what they look like, comment out the static_assert statements before you build and run the application with invalid values.
Download
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.
Personalized inhaled bacteriophage therapy for treatment of multidrug-resistant Pseudomonas aeruginosa in cystic fibrosis by unknow(215299)
CONSORT 2025 statement: updated guideline for reporting randomized trials by unknow(102523)
Critical evaluation of the ProfiLER-02 study design and outcomes by Vivek Subbiah & Razelle Kurzrock(102051)
Cardiac gene therapy makes a comeback by Oliver J. Müller & Susanne Hille & Anca Kliesow Remes(101839)
Whisky: Malt Whiskies of Scotland (Collins Little Books) by dominic roskrow(74624)
Unveiling the design rules for tunable emission in graphene quantum dots: A high-throughput TDDFT and machine learning perspective by Şener Özönder & Mustafa Coşkun Özdemir & Caner Ünlü(51003)
A yeast-based oral therapeutic delivers immune checkpoint inhibitors to reduce intestinal tumor burden by unknow(40375)
Covalent hitchhikers guide proteins to the nucleus by Alexander F. Russell & Madeline F. Currie & Champak Chatterjee(40297)
Meet the Authors: Christopher R. Mansfield and Emily R. Derbyshire by Christopher R. Mansfield & Emily R. Derbyshire(40210)
Alkaline-earth metals promote propane dehydrogenation with carbon dioxide through geometric effects: Altering the reaction pathway by unknow(32815)
Induced iron vacancies boosting FeOOH loaded on sustainable Fenton-like collagen fiber membrane for efficient removal of emerging contaminants by unknow(32612)
Efficient electric-field-assisted photochemical conversion of methane to n-propanol exclusively over penetrated TiO2Ti hollow fibers by Guanghui Feng(32532)
Bi2SiO5 nanosheets as piezo-photocatalyst for efficient degradation of 2,4-Dichlorophenol by Hangyu Shi & Yifu Li & Lishan Zhang & Guoguan Liu & Qian Zhang & Xuan Ru & Shan Zhong(32470)
A novel NDIPTA organic heterojunction photocatalyst with built-in electric field for efficient hydrogen production by Jiahui Yang & Baojun Ma & Yongfa Zhu(32444)
Enhanced conversion of methane to liquid-phase oxygenates via hollow ferrite nanotube@horseradish peroxidase based photoenzymatic catalysis by Jun Duan & Shiying Fan & Xinyong Li & Shaomin Liu(32406)
Ordered macroporous superstructure of defective carbon adorned with tiny cobalt sulfide for selective electrocatalytic hydrogenation of cinnamaldehyde by Xiao-Shi Yuan & Sheng-Hua Zhou & San-Mei Wang & Wenbo Wei & Xiaofang Li & Xin-Tao Wu & Qi-Long Zhu(32335)
What's Done in Darkness by Kayla Perrin(27262)
Topological analysis of non-conjugated ethylene oxide cored dendrimers decorated with tetraphenylethylene: Insights from degree-based descriptors using the polynomial approach by A Theertha Nair & D Antony Xavier & Annmaria Baby & S Akhila(26632)
Investigation of mechanical and self-healing properties of hydroxyl-terminated polybutadiene functionalized with 2-ureido-4-pyrimidinone by Mohsen Kazazi & Mehran Hayaty & Ali Mousaviazar(26556)